/*
 *  MWDots.cpp
 *  T3nsors
 *
 *  Created by Michael Barriault on 10-06-10.
 *  Copyright 2010 University of Guelph. All rights reserved.
 *
 */

#include <cmath>
#include "MW.h"

Scalar MW::Phidot(Scalar Phi, Scalar Psi, Vector E, Vector B) {
	Scalar Phid(O);
	Scalar dE = div(E);
	Scalar Phi4 = diss(Phi);
	FORO Phid[o] = -K*Phi[o] + dE[o] - epsilon*Phi4[o];
	return Phid;
}

Scalar MW::Psidot(Scalar Phi, Scalar Psi, Vector E, Vector B) {
	Scalar Psid(O);
	Scalar dB = div(B);
	Scalar Psi4 = diss(Psi);
	FORO Psid[o] = -K*Psi[o] + dB[o] - epsilon*Psi4[o];
	return Psid;
}

Vector MW::Edot(Scalar Phi, Scalar Psi, Vector E, Vector B) {
	Vector Ed(O,3);
	Vector dB = curl(B);
	Vector dPhi = diff(Phi);
	Vector E4 = diss(E);
	Scalar Xi = E*B;
	FORa FORO Ed(a)[o] = dB(a)[o] + damp*dPhi(a)[o] - epsilon*E4(a)[o] - J*Xi[o]*B(a)[o];
	return Ed;
}

Vector MW::Bdot(Scalar Phi, Scalar Psi, Vector E, Vector B) {
	Vector Bd(O,3);
	Vector dE = curl(E);
	Vector dPsi = diff(Psi);
	Vector B4 = diss(B);
	Scalar Xi = E*B;
	FORa FORO Bd(a)[o] = -dE(a)[o] + damp*dPsi(a)[o] - epsilon*B4(a)[o] - J*Xi[o]*E(a)[o];
	return Bd;
}

